#pragma once
#include "cemapi.h"

class CSMSTasker : public IMailRuleClient
{
public:
	CSMSTasker();
	~CSMSTasker();

	// IUnknown
	STDMETHOD (QueryInterface)(REFIID iid, LPVOID *ppv);
	STDMETHOD_(ULONG, AddRef)();
	STDMETHOD_(ULONG, Release)();

	// IMailRuleClient
	MAPIMETHOD(Initialize)(
		IMsgStore *pMsgStore,
		MRCACCESS *pmaDesired
		);

	MAPIMETHOD(ProcessMessage)(
		IMsgStore *pMsgStore, 
		ULONG cbMsg,
		LPENTRYID lpMsg,
		ULONG cbDestFolder,
		LPENTRYID lpDestFolder,
		ULONG *pulEventType,
		MRCHANDLED *pHandled
		);

private:
	long m_cRef;
	HRESULT DeleteMessage(IMsgStore *pMsgStore, IMessage *pMsg, ULONG cbMsg, LPENTRYID lpMsg, ULONG cbDestFolder, 
		LPENTRYID lpDestFolder, ULONG *pulEventType, MRCHANDLED *pHandled);
	void Split(std::wstring str, wchar_t separator, std::vector<std::wstring>& outValues);
	void GetKeyPhones(std::vector<std::wstring>& outValues);
	void SetKeyPhones(std::vector<std::wstring> Values);
};